Skip to main content

OrderedDictionary<TKey, TValue>

Represents a generic collection of key/value pairs that are ordered independently of the key and value.

Assembly: ServiceStack.Redis.dll
View Source
Declaration
public class OrderedDictionary<TKey, TValue> : IOrderedDictionary<TKey, TValue>, IOrderedDictionary, IDictionary, ICollection, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Properties

Item[Int32]

Gets or sets the value at the specified index.

View Source
Declaration
public TValue this[int index] { get; set; }

IOrderedDictionary.Item[Int32]

Gets or sets the value at the specified index.

View Source
Declaration
object IOrderedDictionary.this[int index] { get; set; }

IDictionary.IsFixedSize

Gets a value indicating whether the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e has a fixed size.

View Source
Declaration
bool IDictionary.IsFixedSize { get; }

IsReadOnly

Gets a value indicating whether the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection is read-only.

View Source
Declaration
public bool IsReadOnly { get; }

IDictionary.Keys

Gets an System.Collections.ICollection object containing the keys in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

View Source
Declaration
ICollection IDictionary.Keys { get; }

IDictionary.Values

Gets an System.Collections.ICollection object containing the values in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

View Source
Declaration
ICollection IDictionary.Values { get; }

Item[TKey]

Gets or sets the value with the specified key.

View Source
Declaration
public TValue this[TKey key] { get; set; }

IDictionary.Item[Object]

Gets or sets the value with the specified key.

View Source
Declaration
object IDictionary.this[object key] { get; set; }

Count

Gets the number of key/values pairs contained in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

View Source
Declaration
public int Count { get; }

ICollection.IsSynchronized

Gets a value indicating whether access to the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e object is synchronized (thread-safe).

View Source
Declaration
bool ICollection.IsSynchronized { get; }

ICollection.SyncRoot

Gets an object that can be used to synchronize access to the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e object.

View Source
Declaration
object ICollection.SyncRoot { get; }

Keys

Gets an System.Collections.Generic.ICollection%7bTKey%7d?text=ICollection%3cTKey%3e object containing the keys in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

View Source
Declaration
public ICollection<TKey> Keys { get; }

Values

Gets an ICollection%7bTValue%7d?text=ICollection%3cTValue%3e object containing the values in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

View Source
Declaration
public ICollection<TValue> Values { get; }

Methods

IOrderedDictionary.GetEnumerator()

View Source
Declaration
IDictionaryEnumerator IOrderedDictionary.GetEnumerator()
Returns

System.Collections.IDictionaryEnumerator

IDictionary.GetEnumerator()

View Source
Declaration
IDictionaryEnumerator IDictionary.GetEnumerator()
Returns

System.Collections.IDictionaryEnumerator

IEnumerable.GetEnumerator()

View Source
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns

System.Collections.IEnumerator

IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()

View Source
Declaration
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
Returns

System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>

Insert(Int32, TKey, TValue)

Inserts a new entry into the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection with the specified key and value at the specified index.

View Source
Declaration
public void Insert(int index, TKey key, TValue value)
Parameters
TypeNameDescription
System.Int32indexThe zero-based index at which the element should be inserted.

| | <TKey> | key | The key of the entry to add.

| | <TValue> | value | The value of the entry to add. The value can be <null></null> if the type of the values in the dictionary is a reference type.

|

IOrderedDictionary.Insert(Int32, Object, Object)

Inserts a new entry into the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection with the specified key and value at the specified index.

View Source
Declaration
void IOrderedDictionary.Insert(int index, object key, object value)
Parameters
TypeNameDescription
System.Int32indexThe zero-based index at which the element should be inserted.

| | System.Object | key | The key of the entry to add.

| | System.Object | value | The value of the entry to add. The value can be <null></null> if the type of the values in the dictionary is a reference type.

|

RemoveAt(Int32)

Removes the entry at the specified index from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

View Source
Declaration
public void RemoveAt(int index)
Parameters
TypeNameDescription
System.Int32indexThe zero-based index of the entry to remove.

|

IDictionary<TKey, TValue>.Add(TKey, TValue)

Adds an entry with the specified key and value into the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection with the lowest available index.

A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p>

View Source
Declaration
void IDictionary<TKey, TValue>.Add(TKey key, TValue value)
Parameters
TypeNameDescription
<TKey>keyThe key of the entry to add.

A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p> | | <TValue> | value | The value of the entry to add. This value can be <null></null>. A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p> |

Add(TKey, TValue)

Adds an entry with the specified key and value into the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection with the lowest available index.

A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p>

View Source
Declaration
public int Add(TKey key, TValue value)
Returns

System.Int32: The index of the newly added entry A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p>

Parameters
TypeNameDescription
<TKey>keyThe key of the entry to add.

A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p> | | <TValue> | value | The value of the entry to add. This value can be <null></null>. A key cannot be <null></null>, but a value can be. <p>You can also use the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property to add new elements by setting the value of a key that does not exist in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> collection; however, if the specified key already exists in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>, setting the <xref href="OrderedDictionary%7bTKey%2cTValue%7d.Item(TKey)" data-throw-if-not-resolved="false"></xref> property overwrites the old value. In contrast, the <xref href="Add" data-throw-if-not-resolved="false"></xref> method does not modify existing elements.</p> |

IDictionary.Add(Object, Object)

Adds an entry with the specified key and value into the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection with the lowest available index.

View Source
Declaration
void IDictionary.Add(object key, object value)
Parameters
TypeNameDescription
System.ObjectkeyThe key of the entry to add.

| | System.Object | value | The value of the entry to add. This value can be <null></null>.

|

Clear()

Removes all elements from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

The capacity is not changed as a result of calling this method.

View Source
Declaration
public void Clear()

ContainsKey(TKey)

Determines whether the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection contains a specific key.

View Source
Declaration
public bool ContainsKey(TKey key)
Returns

System.Boolean: true if the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection contains an element with the specified key; otherwise, false.

Parameters
TypeNameDescription
<TKey>keyThe key to locate in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

|

IDictionary.Contains(Object)

Determines whether the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection contains a specific key.

View Source
Declaration
bool IDictionary.Contains(object key)
Returns

System.Boolean: true if the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection contains an element with the specified key; otherwise, false.

Parameters
TypeNameDescription
System.ObjectkeyThe key to locate in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

|

IndexOfKey(TKey)

Returns the zero-based index of the specified key in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e

This method performs a linear search; therefore it has a cost of O(n) at worst.

View Source
Declaration
public int IndexOfKey(TKey key)
Returns

System.Int32: The zero-based index of <code data-dev-comment-type="paramref" class="paramref">key</code>, if <code data-dev-comment-type="paramref" class="paramref">key</code> is found in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e; otherwise, -1 This method performs a linear search; therefore it has a cost of O(n) at worst.

Parameters
TypeNameDescription
<TKey>keyThe key to locate in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e

This method performs a linear search; therefore it has a cost of O(n) at worst. |

Remove(TKey)

Removes the entry with the specified key from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

View Source
Declaration
public bool Remove(TKey key)
Returns

System.Boolean: true if the key was found and the corresponding element was removed; otherwise, false

Parameters
TypeNameDescription
<TKey>keyThe key of the entry to remove

|

IDictionary.Remove(Object)

Removes the entry with the specified key from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e collection.

View Source
Declaration
void IDictionary.Remove(object key)
Parameters
TypeNameDescription
System.ObjectkeyThe key of the entry to remove

|

ICollection.CopyTo(Array, Int32)

Copies the elements of the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e elements to a one-dimensional Array object at the specified index.

The <xref href="CopyTo" data-throw-if-not-resolved="false"></xref> method preserves the order of the elements in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref>

View Source
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
TypeNameDescription
System.ArrayarrayThe one-dimensional System.Array object that is the destination of the KeyValuePair%602%3e objects copied from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e. The System.Array must have zero-based indexing.

The <xref href="CopyTo" data-throw-if-not-resolved="false"></xref> method preserves the order of the elements in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> | | System.Int32 | index | The zero-based index in <code data-dev-comment-type="paramref" class="paramref">array</code> at which copying begins. The <xref href="CopyTo" data-throw-if-not-resolved="false"></xref> method preserves the order of the elements in the <xref href="ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e" data-throw-if-not-resolved="false"></xref> |

TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

View Source
Declaration
public bool TryGetValue(TKey key, out TValue value)
Returns

System.Boolean: true if the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e contains an element with the specified key; otherwise, false.

Parameters
TypeNameDescription
<TKey>keyThe key of the value to get.

| | <TValue> | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of <code data-dev-comment-type="paramref" class="paramref">value</code>. This parameter can be passed uninitialized.

|

ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue>)

Adds the specified value to the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e with the specified key.

View Source
Declaration
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
Parameters
TypeNameDescription
System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>itemThe KeyValuePair%7bTKey%2cTValue%7d?text=KeyValuePair%3cTKey%2cTValue%3e structure representing the key and value to add to the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

|

ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)

Determines whether the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e contains a specific key and value.

View Source
Declaration
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
Returns

System.Boolean: true if <code data-dev-comment-type="paramref" class="paramref">item</code> is found in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e; otherwise, false.

Parameters
TypeNameDescription
System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>itemThe KeyValuePair%7bTKey%2cTValue%7d?text=KeyValuePair%3cTKey%2cTValue%3e structure to locate in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

|

ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[], Int32)

Copies the elements of the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e to an array of type KeyValuePair%602%3e, starting at the specified index.

View Source
Declaration
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
Parameters
TypeNameDescription
System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>[]arrayThe one-dimensional array of type KeyValuePair%7bTKey%2cTValue%7d?text=KeyValuePair%3cTKey%2cTValue%3e that is the destination of the KeyValuePair%7bTKey%2cTValue%7d?text=KeyValuePair%3cTKey%2cTValue%3e elements copied from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e. The array must have zero-based indexing.

| | System.Int32 | arrayIndex | The zero-based index in <code data-dev-comment-type="paramref" class="paramref">array</code> at which copying begins.

|

ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue>)

Removes a key and value from the dictionary.

View Source
Declaration
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
Returns

System.Boolean: true if the key and value represented by <code data-dev-comment-type="paramref" class="paramref">item</code> is successfully found and removed; otherwise, false. This method returns false if <code data-dev-comment-type="paramref" class="paramref">item</code> is not found in the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

Parameters
TypeNameDescription
System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>itemThe KeyValuePair%7bTKey%2cTValue%7d?text=KeyValuePair%3cTKey%2cTValue%3e structure representing the key and value to remove from the ServiceStack.Redis.Support.OrderedDictionary%602?text=OrderedDictionary%3cTKey%2cTValue%3e.

|

Implements

  • ServiceStack.Redis.Support.IOrderedDictionary<<TKey>,<TValue>>
  • System.Collections.Specialized.IOrderedDictionary
  • System.Collections.IDictionary
  • System.Collections.ICollection
  • System.Collections.Generic.IDictionary<<TKey>,<TValue>>
  • System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>
  • System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<<TKey>,<TValue>>>
  • System.Collections.IEnumerable